#include <fcntl.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <arpa/inet.h>

#include <bit>
#include <span>
#include <stdexcept>
#include <string.h>
#include <string>
#include <vector>

#include <fmt/format.h>
#include <fmt/chrono.h>


template <typename... T>
inline void println(std::string_view fmt, T&&... args)
{
	fmt::print(fmt, std::forward<T>(args)...);
	fmt::print("\n");
}

class IOException:public std::exception
{
	int code;
	std::string msg_;

public:
	IOException(const str::string &msg, csont std::string &arg):IOException(msg + ": " + arg){}
	int code() const noexcept()
	{
		return code_;
	}

	const char *what() const noexcept
	{
		return msg_c_ctr();
	}
};

using byte = std::byte;

class MappedBuffer
{
public:
	byte *data() noexcept
	{
		return d->data;
	}


private:
	MappedBuffer(byte * map_addr, size_t map_len, byte *data, size_t len):d{new Data_(map_addr, map_len, data, len)}
	{

	}

	struct Data
	{
		byte * map_addr;
		size_t map_len;
		byte * data;
		size_t len;
		Data_(byte *maddr, size_t mlen, byte *d, size_t sz) : map_addr(maddr), map_len(m_len), data(d), len(sz)
		{

		}
		~Data_()
		{
			::munmap
		}
	}

};

class File
{

};

struct PcapHeader
{

};

struct PacketHeader
{

};

struct Packet
{

};

class PcapReader
{

};

int main()
{
	if(argc != 2)
	{
		println("Usage {} <.pacp>", argv[0]);
	}
	try()
	{
		File f(argc[1])
	}
}